home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
151-175
/
disk_164
/
polyroot
/
polyroot.txt
< prev
next >
Wrap
Text File
|
1992-05-06
|
3KB
|
114 lines
PolyRoot
This program finds all roots of any
polynomial with real coefficients.
You will first be asked for the
order of the polynomial, then the
coefficients. For example, for the
fourth order equation:
2.7(x^4) - .3(x^3) + 2.6(x) + 1 = 0,
Coefficient #1 = 2.7
Coefficient #2 = -.3
Coefficient #3 = 0 (x^2 term)
Coefficient #4 = 2.6
Coefficient #5 = 1 (x^0 term)
After the coefficients have been
entered, the program will open a
status window and solve the equation.
Typical polynomials will be
solved in a few seconds. Others will
take longer.
If you need to access other tasks
during this time, use the front/back
menu selection. Multi-tasking will
be limited with 512k.
When the process is complete, the
roots will be displayed. Along with
the roots will be columns titled
'residuals' and 'tolerance'.
Residuals were obtained by
inserting the root into the original
polynomial and evaluating. A value
close to zero generally indicates a
good solution, but this is quite
dependent on the coefficients.
More significant is the tolerance
column. This indicates the magnitude
of error. For example, if a root is:
2.7227711315D+00 + 7.1132580714D+01
with a tolerance of ± 3.117D-06, the
solution is accurate to the 5th
decimal place, or:
2.72277D+00 + 7.113258D+01
You may send results to a disk
file or printer. If the disk file
named exists, the program will
request permission to overwrite.
If any roots scroll, use 'Show' to
re-display them.
The solution technique used is
Bairstow's factorization method
coupled with a Newtonian iteration
scheme to refine roots. Thus, the
algorithm may have difficulty
converging if a root exists near a
point where the derivative of the
polynomial is zero or infinity.
Should this happen, a message will
be displayed for each root that does
not converge. If the final results
have unacceptable errors, adjust the
tolerance and iteration limits.
Observe how your changes affect the
residual and tolerance values.
If there is a strong divergence,
increasing the number of iterations
could magnify the error. In this
case, reduce the number of iterations
and/or decrease the tolerance to
obtain at least a general idea of
root location.
In cases where there are no
convergence problems, tolerance and
iteration settings may be used to
"dial-in" the desired degree of
accuracy. These values are reset to
their defaults for each new equation.
The author may be reached at:
Jon Giorgini
1321 Cherokee Avenue
West St. Paul, MN 55118